package com.manli.api.pojo.dingdanxia;

import org.apache.commons.lang3.StringUtils;

public class ReturnMsgTemplate {
    /**
     * 没有优惠券的返回消息模板
     * @return
     */
    public static String noConpuns(){
        StringBuffer stringBuffer = new StringBuffer("呀~该商家没有设置优惠耶( •̀ ω •́ )");
        return stringBuffer.toString();
    }

    /**
     * 账号分享绑定
     * @return
     */
    public static String shareBind(String name){
        StringBuffer stringBuffer = new StringBuffer("----绑定成功----\n");
        stringBuffer.append("已成功绑定到[" + name +"]名下\n");
        return stringBuffer.toString();
    }

    /**
     * 账号分享绑定
     * @return
     */
    public static String shareBind1(String name){
        StringBuffer stringBuffer = new StringBuffer("----绑定成功----\n");
        stringBuffer.append("[" + name +"]已成功绑定到您的名下\n");
        return stringBuffer.toString();
    }

    /**
     * 第一次添加好友后的欢迎词
     * @return
     */
    public static String welcome(){
        StringBuffer stringBuffer = new StringBuffer("亲亲，感谢您关注漫淘淘优惠平台~\n");
        stringBuffer.append("咱们为您提供各大商城的优惠券哟~\n");
        stringBuffer.append("淘宝，京东，拼多多~\n");
        stringBuffer.append("只需要将淘宝，京东，拼多多的分享或者链接发我哟~\n");
        stringBuffer.append(" \n");
        stringBuffer.append("发送【客服】获取人工服务\n");
        return stringBuffer.toString();
    }

    /**
     * 有优惠券的返回消息模板
     * @return
     */
    public static String conpunMsg(TklToHelpersReturn tklToHelpersReturn){
        StringBuffer stringBuffer = new StringBuffer("呀~有优惠耶( •̀ ω •́ )\n");
        stringBuffer.append(StringUtils.isEmpty(tklToHelpersReturn.getItemInfo().getTitle())?"":"商品：" + tklToHelpersReturn.getItemInfo().getTitle() + "\n");
        stringBuffer.append(StringUtils.isEmpty(tklToHelpersReturn.getItemInfo().getReservePrice())?"":"一口价：" + tklToHelpersReturn.getItemInfo().getReservePrice() + "\n");
        stringBuffer.append(StringUtils.isEmpty(tklToHelpersReturn.getItemInfo().getZkFinalPrice())?"":"折扣价：" + tklToHelpersReturn.getItemInfo().getZkFinalPrice() + "\n");
        stringBuffer.append(StringUtils.isEmpty(tklToHelpersReturn.getItemInfo().getQhFinalPrice())?"":"券后价：" + tklToHelpersReturn.getItemInfo().getQhFinalPrice() + "\n");
        stringBuffer.append(StringUtils.isEmpty(tklToHelpersReturn.getItemInfo().getQhFinalCommission())?"":"返利：" + tklToHelpersReturn.getItemInfo().getQhFinalCommission() + "\n");
        stringBuffer.append(tklToHelpersReturn.getCouponTpwd() + "\n");
        stringBuffer.append("【长按复制本条消息，然后打开啕寳，自动显示优惠券】");
        return stringBuffer.toString();
    }

    /**
     * 分享链接title.传入价格单位（分）
     * @return
     */
    public static String shareTitle(String coupon,String price){
        Double couponDouble = Double.valueOf(String.format("%.2f", Double.parseDouble(coupon) / 100));
        Double priceDouble = Double.valueOf(String.format("%.2f", (Double.parseDouble(price) -  Double.parseDouble(coupon)) / 100));

        StringBuffer stringBuffer = new StringBuffer("优惠券：");
        stringBuffer.append(couponDouble);
        stringBuffer.append(" 券后价：");
        stringBuffer.append(priceDouble);
        stringBuffer.append(" 返利：0");
        return stringBuffer.toString();
    }

    /**
     * 分享链接title.传入价格单位（元）
     * @return
     */
    public static String shareTitleYuan(Double coupon,Double price,Double commission){

        StringBuffer stringBuffer = new StringBuffer("优惠券：");
        stringBuffer.append(coupon == null?"0":coupon);
        stringBuffer.append(" 券后价：");
        stringBuffer.append(coupon == null?price:String.format("%.2f", (price -  coupon)));
        stringBuffer.append(commission == null?"":" 返利：" + String.format("%.2f", commission));
        return stringBuffer.toString();
    }
}
